package nacos.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RefreshScope      //保证配置文件动态刷新
public class NacosConfig9904Controller {
    @Value("${server.port}")
    private String port;

    @Value("${controller.info}")
    private String info;

    @Value("${controller.info2}")
    private String info2;

    @Value("${controller.info3}")
    private String info3;

    @GetMapping("/c")
    public String c(){
        return "provider-colony-" + this.port + "-c1";
    }

    /**
     * 比较nacos、bootstrap、application配置优先级
     */
    @GetMapping("c1")
    public String c1(){
        return "nacos-config-9904-" + this.info;
    }

    /**
     * 比较bootstrap、application优先级
     */
    @GetMapping("c2")
    public String c2(){
        return "nacos-config-9904-" + this.info2;
    }

    @GetMapping("c3")
    public String c3(){
        return "nacos-config-9904-" + this.info3;
    }
}
